# Contributor: Marvin Preuss <marvin@xsteadfastx.org>
# Maintainer: Marvin Preuss <marvin@xsteadfastx.org>
pkgname=speedtest_exporter
pkgver=0.3.1
pkgrel=3
pkgdesc="Prometheus exporter for Speedtest metrics"
url="https://github.com/nlamirault/speedtest_exporter"
# riscv64 unsupported by Golang deps
arch="all !riscv64"
license="Apache-2.0"
makedepends="bash go make"
checkdepends="glide"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
pkgusers="speedtest-exporter"
pkggroups="speedtest-exporter"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/nlamirault/speedtest_exporter/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	0001-Fix-log.Infof-format-test-error.patch
	"

build() {
	make build
}

check() {
	make test
}

package() {
	install -Dm755 speedtest_exporter "$pkgdir"/usr/bin/speedtest_exporter

	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
}
sha512sums="
cb6073ca622e8df2b8436a2e30af2c9c7c99be6d950d4383de014c000e279a1ea0394bed3097754f24923859bbc2d5ebf20787eb90417c15aad35a0b88b64161  speedtest_exporter-0.3.1.tar.gz
29fa32f35accbc8f26864258c957e1dbaf03e54b68c2361ba2c664fca65de8cfeac971ed96e48b0d556611f7af041b1f4711a36e189a3e746fc2a22cecece2fb  speedtest_exporter.initd
5110af642337757b6dd7abc3d9051f2f46256300cf6d8d29e94b5a3acc4fc7920e0d498f568e1831ce4821c8550d8752875a3077df5cc03b40b2282742e924df  speedtest_exporter.confd
fb38b8ac3b033e89c01180a171c108695e63ce2ca697b8e4fd199a7d4efd328890451ecfcda570361ea19573d4690235982245ca2493e9907d3d04944e208b81  0001-Fix-log.Infof-format-test-error.patch
"
